<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>题库 - CodeMaster 在线OJ系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary: #2563eb;
            --secondary: #1e40af;
            --accent: #3b82f6;
            --light: #f8fafc;
            --dark: #1e293b;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --gray: #64748b;
            --light-gray: #e2e8f0;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: var(--dark);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 导航栏样式 */
        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 1rem 0;
            position: sticky;
            top: 0;
            z-index: 1000;
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
        }

        .nav-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--primary);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .nav-links {
            display: flex;
            gap: 1.5rem;
            align-items: center;
        }

        .nav-links a {
            color: var(--dark);
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s ease;
            padding: 0.5rem 1rem;
            border-radius: 8px;
        }

        .nav-links a:hover {
            color: var(--primary);
            background: rgba(37, 99, 235, 0.1);
        }

        .nav-links a.active {
            color: var(--primary);
            background: rgba(37, 99, 235, 0.2);
        }

        .login-btn {
            background: var(--primary);
            color: white !important;
            padding: 0.5rem 1.5rem !important;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .login-btn:hover {
            background: var(--secondary) !important;
            transform: translateY(-2px);
        }

        /* 主要内容区域 */
        .question_list {
            padding: 2rem 0;
            min-height: calc(100vh - 200px);
        }

        .header {
            text-align: center;
            margin-bottom: 3rem;
            color: white;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 0.5rem;
            font-weight: 800;
        }

        .header p {
            font-size: 1.1rem;
            opacity: 0.9;
        }

        /* 表格样式 */
        .question-table {
            background: white;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
        }

        .table-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            color: white;
            padding: 1.5rem 2rem;
            display: grid;
            grid-template-columns: 100px 1fr 120px;
            gap: 1rem;
            font-weight: 600;
            font-size: 1.1rem;
        }

        .question-row {
            display: grid;
            grid-template-columns: 100px 1fr 120px;
            gap: 1rem;
            padding: 1.5rem 2rem;
            border-bottom: 1px solid var(--light-gray);
            transition: background-color 0.3s ease;
            align-items: center;
        }

        .question-row:last-child {
            border-bottom: none;
        }

        .question-row:hover {
            background-color: #f1f5f9;
        }

        .question-number {
            font-weight: 600;
            color: var(--primary);
            font-size: 1.1rem;
        }

        .question-title a {
            color: var(--dark);
            text-decoration: none;
            font-weight: 500;
            font-size: 1.1rem;
            transition: color 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .question-title a:hover {
            color: var(--primary);
        }

        .question-title a i {
            font-size: 0.8rem;
            opacity: 0.7;
        }

        .difficulty {
            padding: 0.3rem 1rem;
            border-radius: 20px;
            font-weight: 600;
            text-align: center;
            font-size: 0.9rem;
        }

        .difficulty-easy {
            background-color: #dcfce7;
            color: #16a34a;
        }

        .difficulty-medium {
            background-color: #ffedd5;
            color: #ea580c;
        }

        .difficulty-hard {
            background-color: #fee2e2;
            color: #dc2626;
        }

        /* 搜索和筛选 */
        .filters {
            display: flex;
            gap: 1rem;
            margin-bottom: 2rem;
            flex-wrap: wrap;
        }

        .search-box {
            flex: 1;
            min-width: 300px;
            position: relative;
        }

        .search-box input {
            width: 100%;
            padding: 1rem 1rem 1rem 3rem;
            border: none;
            border-radius: 12px;
            font-size: 1rem;
            background: white;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }

        .search-box i {
            position: absolute;
            left: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--gray);
        }

        .filter-select {
            padding: 1rem;
            border: none;
            border-radius: 12px;
            background: white;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            min-width: 150px;
        }

        /* 页脚 */
        .footer {
            background: rgba(255, 255, 255, 0.9);
            padding: 2rem 0;
            text-align: center;
            margin-top: 3rem;
            border-top: 1px solid var(--light-gray);
        }

        .footer h4 {
            color: var(--gray);
            font-weight: 500;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .question-row,
            .table-header {
                grid-template-columns: 60px 1fr 100px;
                padding: 1rem;
                gap: 0.5rem;
            }

            .filters {
                flex-direction: column;
            }

            .search-box {
                min-width: 100%;
            }
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .question-row {
            animation: fadeIn 0.5s ease-out;
        }

        .question-row:nth-child(odd) { animation-delay: 0.1s; }
        .question-row:nth-child(even) { animation-delay: 0.2s; }
    </style>
</head>

<body>
    <div class="container">
        <!-- 导航栏 -->
        <nav class="navbar">
            <div class="nav-container">
                <a href="/" class="logo">
                    <i class="fas fa-code"></i>
                    CodeMaster
                </a>
                <div class="nav-links">
                    <a href="/">首页</a>
                    <a href="/all_questions" class="active">题库</a>
                    <a href="#">竞赛</a>
                    <a href="#">讨论</a>
                    <a href="#" class="login-btn">登录</a>
                </div>
            </div>
        </nav>

        <!-- 题目列表 -->
        <div class="question_list">
            <div class="header">
                <h1>编程题库</h1>
                <p>挑战自我，提升编程技能</p>
            </div>

            <!-- 搜索筛选 -->
            <div class="filters">
                <div class="search-box">
                    <i class="fas fa-search"></i>
                    <input type="text" placeholder="搜索题目..." id="searchInput">
                </div>
                <select class="filter-select" id="difficultyFilter">
                    <option value="">所有难度</option>
                    <option value="简单">简单</option>
                    <option value="中等">中等</option>
                    <option value="困难">困难</option>
                </select>
            </div>

            <!-- 题目表格 -->
            <div class="question-table">
                <div class="table-header">
                    <div>编号</div>
                    <div>题目</div>
                    <div>难度</div>
                </div>
                
                {{#question_list}}
                <div class="question-row">
                    <div class="question-number">{{number}}</div>
                    <div class="question-title">
                        <a href="/question/{{number}}">
                            {{title}}
                            <i class="fas fa-external-link-alt"></i>
                        </a>
                    </div>
                    <div class="difficulty difficulty-{{#star}}简单{{/star}}{{#star}}中等{{/star}}{{#star}}困难{{/star}}">
                        {{star}}
                    </div>
                </div>
                {{/question_list}}
            </div>
        </div>

        <!-- 页脚 -->
        <div class="footer">
            <h4>@李俊桦 - CodeMaster 在线评测系统</h4>
        </div>
    </div>

    <script>
        // 简单的搜索和筛选功能
        document.addEventListener('DOMContentLoaded', function() {
            const searchInput = document.getElementById('searchInput');
            const difficultyFilter = document.getElementById('difficultyFilter');
            const questionRows = document.querySelectorAll('.question-row');

            function filterQuestions() {
                const searchText = searchInput.value.toLowerCase();
                const difficulty = difficultyFilter.value;

                questionRows.forEach(row => {
                    const title = row.querySelector('.question-title a').textContent.toLowerCase();
                    const rowDifficulty = row.querySelector('.difficulty').textContent;
                    
                    const matchesSearch = title.includes(searchText);
                    const matchesDifficulty = difficulty === '' || rowDifficulty === difficulty;
                    
                    row.style.display = (matchesSearch && matchesDifficulty) ? 'grid' : 'none';
                });
            }

            searchInput.addEventListener('input', filterQuestions);
            difficultyFilter.addEventListener('change', filterQuestions);

            // 为难度添加对应的CSS类
            questionRows.forEach(row => {
                const difficulty = row.querySelector('.difficulty').textContent.trim();
                if (difficulty === '简单') {
                    row.querySelector('.difficulty').className = 'difficulty difficulty-easy';
                } else if (difficulty === '中等') {
                    row.querySelector('.difficulty').className = 'difficulty difficulty-medium';
                } else if (difficulty === '困难') {
                    row.querySelector('.difficulty').className = 'difficulty difficulty-hard';
                }
            });
        });
    </script>
</body>

</html>